﻿<Page x:Class="JasRibbonApplicatie.Views.MagazijniersPlanning"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:src="clr-namespace:JasRibbonApplicatie.Converters"
      
      mc:Ignorable="d" 
      d:DesignHeight="563" d:DesignWidth="971"
	Title="MagazijniersPlanning">
    
    <Page.Resources>
        <Style TargetType="CalendarDayButton" x:Key="calstyle">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="CalendarDayButton">
                        <ControlTemplate.Resources>
                            <src:CalendarRedLetterConverter x:Key="conv" />
                        </ControlTemplate.Resources>

                        <Grid ToolTip="{Binding Converter={StaticResource conv}, 
                                                    Mode=OneWay}">
                            
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0:0:0.1" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" To=".5" Duration="0" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" To=".5" Duration="0" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                                            <DoubleAnimation Storyboard.TargetName="NormalText" Storyboard.TargetProperty="Opacity" To=".35" Duration="0" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="SelectionStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Unselected" />
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="SelectedBackground" Storyboard.TargetProperty="Opacity" To=".75" Duration="0" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="CalendarButtonFocusStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="CalendarButtonFocused">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DayButtonFocusVisual" Storyboard.TargetProperty="Visibility" Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="CalendarButtonUnfocused">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DayButtonFocusVisual" Storyboard.TargetProperty="Visibility" Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Collapsed</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="ActiveStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Active" />
                                    <VisualState x:Name="Inactive">
                                        <Storyboard>
                                            <ColorAnimation Duration="0" Storyboard.TargetName="selectedText" Storyboard.TargetProperty="Color" To="#FF777777"></ColorAnimation>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="DayStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="RegularDay" />
                                    <VisualState x:Name="Today">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="TodayBackground" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                            <ColorAnimation Duration="0" Storyboard.TargetName="selectedText" Storyboard.TargetProperty="Color" To="#FFFFFFFF"></ColorAnimation>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="BlackoutDayStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="NormalDay" />
                                    <VisualState x:Name="BlackoutDay">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" Storyboard.TargetName="Blackout" Storyboard.TargetProperty="Opacity" To=".2"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Rectangle x:Name="TodayBackground" RadiusX="1" RadiusY="1" Opacity="0" Fill="#FFAAAAAA"/>

                            <Rectangle x:Name="RedLetterDayBackground" IsHitTestVisible="False" Fill="#80FF0000" />

                            <Rectangle x:Name="SelectedBackground" RadiusX="1" RadiusY="1" Opacity="0" Fill="{TemplateBinding Background}"/>
                            <Rectangle x:Name="Background" RadiusX="1" RadiusY="1" Opacity="0" Fill="{TemplateBinding Background}"/>
                            <ContentPresenter
                                    x:Name="NormalText"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Margin="5,1,5,1"
                                    >
                                <TextElement.Foreground>
                                    <SolidColorBrush x:Name="selectedText" Color="#FF333333"/>
                                </TextElement.Foreground>
                            </ContentPresenter>
                            <Path x:Name="Blackout" Opacity="0" Margin="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RenderTransformOrigin="0.5,0.5" Fill="#FF000000" Stretch="Fill" Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z"/>
                            <Rectangle x:Name="DayButtonFocusVisual" Visibility="Collapsed" IsHitTestVisible="false" RadiusX="1" RadiusY="1" Stroke="#FF45D6FA"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True">
                                <Setter TargetName="DayButtonFocusVisual" Property="Visibility" Value="Visible" />
                            </Trigger>

                            <DataTrigger Binding="{Binding Converter={StaticResource conv}}"
                                             Value="{x:Null}">
                                <Setter TargetName="RedLetterDayBackground" 
                                            Property="Visibility" Value="Hidden" />
                            </DataTrigger>

                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Page.Resources>
  

    <Grid HorizontalAlignment="Left" Width="966" VerticalAlignment="Top" Height="536">
        <GroupBox Header="Magazijnier toevoegen aan agenda" Height="280" HorizontalAlignment="Left" Margin="645,19,0,0" Name="addMagazijnierToSheduleGroupBox" VerticalAlignment="Top" Width="282">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="50*" />
                    <ColumnDefinition Width="220*" />
                </Grid.ColumnDefinitions>
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="6,45,0,0" Name="datePicker" VerticalAlignment="Top" Width="180" Grid.ColumnSpan="2" />
                <ComboBox Height="23" HorizontalAlignment="Left" Margin="6,16,0,0" Name="magazijniersComboBox" VerticalAlignment="Top" Width="180" Grid.ColumnSpan="2" />
                <Button Content="Voeg toe aan agenda" Height="23" HorizontalAlignment="Left" Margin="6,105,0,0" Name="addToPlanning" VerticalAlignment="Top" Width="135" Click="addToPlanning_Click" Grid.ColumnSpan="2" />
                <ComboBox Height="23" HorizontalAlignment="Left" Margin="6,76,0,0" Name="timePickerComboBox" VerticalAlignment="Top" Width="104" Grid.ColumnSpan="2" />
            </Grid>
        </GroupBox>
        <GroupBox Header="Selecteer agenda" Height="506" HorizontalAlignment="Left" Margin="12,18,0,0" Name="selectSheduleGroupBox" VerticalAlignment="Top" Width="627">
            <Grid>
                <DataGrid AutoGenerateColumns="False" Height="Auto" HorizontalAlignment="Left" Margin="5,273,0,0" Name="sheduleGrid" VerticalAlignment="Top" Width="Auto" DataContext="{Binding}" HeadersVisibility="Column" CanUserResizeRows="False" CanUserResizeColumns="False" SelectionChanged="sheduleGrid_SelectionChanged">
                    <DataGrid.Columns>
                        <DataGridTextColumn Binding="{Binding Datum, StringFormat='dd/MM/yyyy HH:mm'}" Header="Datum" IsReadOnly="True" />
                        <DataGridTextColumn Binding="{Binding Magazijnier.Gebruiker.Voornaam}" Header="Voornaam" IsReadOnly="True" />
                        <DataGridTextColumn Binding="{Binding Magazijnier.Gebruiker.Naam}" Header="Achternaam" IsReadOnly="True" />
                        <DataGridTextColumn Binding="{Binding Magazijnier.Gebruiker.Gsm}" Header="Gsm" IsReadOnly="True" />
                        <DataGridTextColumn Binding="{Binding Magazijnier.Gebruiker.Mail}" Header="Email" IsReadOnly="True" />
                        <DataGridTemplateColumn Header="Verwijder">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    
                                    <Button x:Name="deleteButton"
                                Click="deleteButton_Click" Content="Verwijder">
                   
                                    </Button>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
                <Calendar Height="170" HorizontalAlignment="Left" Margin="6,99,0,0" Name="calendar" VerticalAlignment="Top" Width="180" SelectedDatesChanged="calendar_SelectedDatesChanged" SelectionMode="SingleDate" CalendarDayButtonStyle="{DynamicResource ResourceKey=calstyle}"></Calendar>
                <Button Content="Overzicht planning alle magazijniers" Height="23" HorizontalAlignment="Left" Margin="6,70,0,0" Name="overzichtButton" VerticalAlignment="Top" Width="235" Click="overzichtButton_Click" />
                <ComboBox Height="23" HorizontalAlignment="Left" Margin="166,41,0,0" Name="searchComboBox" VerticalAlignment="Top" Width="180" SelectionChanged="searchComboBox_SelectionChanged" />
                <DatePicker Height="23" HorizontalAlignment="Left" Margin="166,10,0,0" Name="sheduleFromDatePicker" VerticalAlignment="Top" Width="180" SelectedDateChanged="sheduleFromDatePicker_SelectedDateChanged" />
                <Label Content="Overzicht planning vanaf:" Height="30" HorizontalAlignment="Left" Margin="6,10,0,0" Name="overzichtPlanningLabel" VerticalAlignment="Top" Width="154" />
                <Label Content="Selecteer magazijnier:" Height="28" HorizontalAlignment="Left" Margin="6,36,0,0" Name="selecteerMagazijnierLabel" VerticalAlignment="Top" Width="154" />
            </Grid>
        </GroupBox>
    </Grid>
</Page>
